#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <cstdio>
#include <string>
#include <stack>
#include <set>
#define IOS ios::sync_with_stdio(false), cin.tie(0)
using namespace std;
typedef long long ll;
int f[2100];
ll c[2100];
ll x[2100];
ll ans[2100];
int main()
{
    IOS;
    ll M,L,N;
    while(cin>>M>>L&&(M||L)){
        ll sum=0;
        ll maxn=0;
        memset(x,-1,sizeof(x));
        memset(f,-1,sizeof(f));
        f[0]=0;
        cin>>N;
        for(ll i=1;i<=N;i++){
            cin>>c[i];
            sum+=c[i];
            maxn=max(maxn,c[i]);
        }
        if(sum>M+L){
            cout<<"Impossible to distribute"<<endl;
            continue;
        }
        for(ll i=1;i<=N;i++){
            for(ll j=M;j>=c[i];j--){
                if(f[j-c[i]]!=-1&&f[j-c[i]]+c[i]>f[j]){
                    x[j]=i;
                    f[j]=f[j-c[i]]+c[i];
                }
            }
        }
        // cout<<f[N][M]<<endl;
        while(f[M]==-1){
            M--;
        }
        ll ch=sum-f[M];
        if(L<ch){
            cout<<"Impossible to distribute"<<endl;
            continue;
        }
        ll cnt=0;
        ll id=N;
        for(ll i=M;i>0;){
            ans[cnt++]=x[i];
            i-=c[x[i]];
            // if(id==0)break;
            // cout<<"id="<<id<<endl;
            // ans[cnt++]=id;
        }
        sort(ans,ans+cnt);
        cout<<cnt;
        for(ll i=0;i<cnt;i++){
            cout<<" "<<ans[i];
        }
        cout<<endl;
    }
    getchar();
    getchar();
    return 0;
}
